package com.yc.fav.servlet;

import com.yc.base.servlet.BaseServlet;
import com.yc.fav.mapper.FavMapper;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.ibatis.session.SqlSession;
import org.example.util.MyBatisUtils;

import java.io.IOException;

@WebServlet("/index/*")
public class IndexServlet extends BaseServlet {
    public Object hello(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        try(SqlSession session = MyBatisUtils.getSession();){
            FavMapper mapper = session.getMapper(FavMapper.class);
            return mapper.selectList(null);
        }
    }
}
